package org.snail.du.service.impl;

import lombok.extern.log4j.Log4j;
import org.apache.log4j.Logger;
import org.snail.du.bean.DUDO;
import org.snail.du.mapper.DuMapper;
import org.snail.du.service.DuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Log4j
public class DuServiceImpl implements DuService{
    private static final Logger logger = Logger.getLogger(DuServiceImpl.class);

    @Autowired
    private DuMapper duMapper;

    /**
     * 查询所有员工所在的du
     * @return
     */
    @Override
    public List<DUDO> findAllDu() {
        List<DUDO> dudos = null;
        try {
            dudos = duMapper.findAllDu();
        }catch (Exception e){
            log.error("查询DU失败:"+e.getMessage());
        }
        return dudos;
    }

    /**
     * 保存du列表
     * @param dudos du列表
     */
    @Override
    public void insertDu(List<DUDO> dudos) {
        try {
            duMapper.insertDUList(dudos);
        }catch (Exception e){
            log.error("保存du列表失败:"+e.getMessage());
        }

    }
}